package com.rd.student.dashuju.sunwenzhuo.Test2;

import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Set;

public class Test7 {

    public static void main(String[] args) {


        String str = "哈尔滨,大庆,绥化,齐齐哈尔,杭州,宁波,南昌,广州,福州,厦门";
        String str2 = "黑龙江省,黑龙江省,黑龙江省,黑龙江省,浙江省,浙江省,江西省,广东省,福建省,福建省";

        String[] s = str.split(",");
        String[] s1 = str2.split(",");

        HashMap hashMap = new HashMap();

        for (int i = 0; i < s.length; i++) {
            String key = s[i];
            String value = s1[i];

            hashMap.put(key, value);
        }

        Set set = hashMap.keySet();
        Iterator iterator = set.iterator();
        while (iterator.hasNext()) {
            Object key = iterator.next();
            Object value = hashMap.get(key);

            System.out.println(value + "=" + key);
        }
        System.out.println("-----------");

        HashMap hashMap1 = new HashMap();
        for (int i = 0; i < s1.length; i++) {

            String key1 = s1[i];

            LinkedList linkedList = new LinkedList();


            linkedList.add(hashMap1);

            if (!hashMap1.containsKey(key1)) {
                hashMap1.put(key1, 1);
            } else {
                int value1 = (int) hashMap1.get(key1);
                hashMap1.put(key1, value1 + 1);
            }
        }

            Set set1 = hashMap1.keySet();
            Iterator iterator1 = set1.iterator();

            while (iterator1.hasNext()) {

                Object key = iterator1.next();
                Object value1 = hashMap1.get(key);

                System.out.println(key + ":" + value1);
            }

    }

}
